Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Display fpfit equation in a twoway scatter plot || fpfit

    I am trying to get the relationship between Life Expectancy and GDP (Preston curve). I already have plotted a twoway scatter plot and a fpfit line, that fit well with the relationship, but I do not know how to get the fpfit equation. Happy if somebody knows how can I do it.

  • #2
    You are just fitting a fractional polynomial, and the default is degree 2.

    Code:
    webuse grunfeld, clear
    regress invest c.mvalue#c.mvalue
    predict investhat, xb
    tw scatter investhat mvalue, msize(tiny) mcolor(red)
    gr save gr1.gph, replace
    tw scatter invest mvalue|| fpfit invest mvalue, leg(off)
    gr save gr2.gph, replace
    gr combine gr1.gph gr2.gph
    Res.:

    Click image for larger version

Name:	Graph.png
Views:	1
Size:	41.0 KB
ID:	1552744

    Comment


    • #3
      Thanks Andrew for your comment. I am doing that. What I needed was to get the equation of the fractional polynomial fit curve. Finally I got it transforming the GNI to ln(GNI) and then a lineal regression.

      Comment


      • #4
        The model in #2 is

        $$\text{invest}_{i}= \beta_{0}+ \beta_{1}\text{mvalue}_{i}^{2} + u_{i}$$

        where \(i\) is the observation of a firm in a given year. It is estimated using OLS and we obtain the predicted outcome

        $$\widehat{\text{invest}}_{i}= \hat{\beta_{0}}+ \hat{\beta_{1}}\text{mvalue}_{i}^{2}$$


        So the graph on the left hand side is a scatter plot of \(\widehat{\text{invest}}\) and mvalue.

        Comment

        Working...
        X